<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件化的基本使用</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <!-- <h2>我是标题</h2>
        <p>我是内容</p>
        <p>我也是内容</p> -->
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
    </div>
    <script>
        //1. 创建组件构造器对象
        const cpnConstructor = Vue.extend({
            template:`
                <div>
                    <h2>我是标题</h2>
                    <p>我是内容</p>
                    <p>我也是内容</p>
                </div>`
        })
        //2. 注册组件
        Vue.component("my-cpn", cpnConstructor)

        const app = new Vue({
            el: "#app",
            data: {
                
            }
        })
    </script>
</body>
</html>